<?php
$this->breadcrumbs=array(
	'Packages'=>array('index'),
	'Manage',
);

$this->menu = array(
    array('label' => 'Default users', 'url' => array('/user/defaultUser/index')),
    array('label' => 'Suppliers', 'url' => array('/user/supplier/index')),
    array('label' => 'Transporters', 'url' => array('/user/transporter/index')),
    array('label' => 'Category', 'url' => array('/admin/category/index')),
    array('label' => 'Package', 'url' => array('/admin/buildTree/admin')),
    array('label' => 'Help', 'url' => array('')),
    array('label' => 'Font End', 'url' => array('')),
);

Yii::app()->clientScript->registerScript('search', "
$('.search-button').click(function(){
	$('.search-form').toggle();
	return false;
});
$('.search-form form').submit(function(){
	$.fn.yiiGridView.update('package-grid', {
		data: $(this).serialize()
	});
	return false;
});
");


?>

<?php foreach ($cate_root as $cate) :  ?>
<h1>Manage Packages of <?php echo $cate['name'].CHtml::link('Add', Yii::app()->request->baseUrl.'/index.php?r=admin/buildTree/create/category/'.$cate['id']); ?></h1>

<?php if(0!=Package::model()->count('cate_id = '.$cate['id'])) : ?>
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'package-grid',
	'dataProvider'=>$model->search($cate['id']),
	//'filter'=>$model,
	'columns'=>array(
		'id',
		'name',
		'file',
		'desc',
                'cate_id',
		array(
			'class'=>'CButtonColumn',
		),
	),
)); ?>
<?php endif; ?>
<?php endforeach; ?>
